﻿package {
	import flash.net.*;
	import flash.events.*;
	public class XMLManager extends EventDispatcher {
		public function XMLManager() {

		}
		public function LoadXML(pach:String):void {
			var ld:URLLoader=new URLLoader();
			ld.load(new URLRequest(pach));
			ld.addEventListener(Event.COMPLETE,resultHandle);
			ld.addEventListener(IOErrorEvent .IO_ERROR,errorhandle);
		}
		private function resultHandle(e:Event):void {
			var myxml:XML=XML(e.target.data );
			var sendevent:LoadEvent=new LoadEvent(LoadEvent.LOADXML);
			sendevent.result=myxml;
			this.dispatchEvent(sendevent);

		}
		private function errorhandle(e:Event):void {
			throw new Error("加载失败");

		}
	}
}